package com.tyun.modules.sys.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.tyun.common.utils.R;
import com.tyun.modules.sys.entity.TimerJob;
import com.tyun.modules.sys.service.ITimerJobService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 定时任务
 *
 * @author congcong tao
 * @date 2018/9/20 17:34
 */
@RestController
@RequestMapping("timerJob")
public class TimerJobController extends CommonController{

    private static final Logger logger = LogManager.getLogger(TimerJobController.class);

    @Autowired
    private ITimerJobService timerJobService;

    @GetMapping("/page")
    public R page(Page<TimerJob> page, TimerJob timerJob){
        timerJobService.selectPage(page, new EntityWrapper<>(timerJob));
        return R.ok().put("rows", page.getRecords()).put("total", page.getTotal());
    }
}
